<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .box {
            width: 100%;
            height: 700px;

        }

        .box-1 {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100%;
            background: url(./beijing.png) no-repeat center/cover;
        }

        .box-dr {
            text-align: center;
            padding-top: 100px;
            border: 2px solid skyblue;
            width: 300px;
            height: 300px;
            font-size: 20px;
            color: rgb(233, 233, 233);
        }

        .dr,
        .zc {
            margin: 10px 20px;
            width: 50px;
            height: 50px;
            border-radius: 15px;
            color: black
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="box-1">
            <div class="box-dr">
                手机号:<input type="text" id="phone"><br>
                密&nbsp;&nbsp;&nbsp;码:<input type="password" id="password"><br>
                <button class="zc">注册</button><button class="dr">登入</button><br>
            </div>
        </div>
    </div>
    <script src="./jquery-3.7.1(2).js"></script>
    <script>
        $(".dr").click(function () {
            console.log($("#phone").val() + "--" + $("#password").val());
            $.ajax({
                url: "http://172.16.106.87:8080/login",
                type: "get",
                data: {
                    phone: $("#phone").val(),
                    password: $("#password").val()
                },
                success(itms) {
                    console.log(itms);
                    if (itms.code == 200) {
                        alert("登入成功")
                        localStorage.setItem("ueradd", JSON.stringify(itms))
                    }
                }
            })
        })
        $(".zc").click(function () {
            location.href = "002.html"
        })
    </script>
</body>

</html>